home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig11_10.jar
/
Ch11
/
Fig11_10
/
Fig11_10.cpp
Wrap
C/C++ Source or Header
|
1997-10-29
|
415b
|
20 lines
// Fig. 11.10: fig11_10.cpp
// Avoiding a precedence problem between the stream-insertion
// operator and the conditional operator.
// Need parentheses around the conditional expression.
#include <iostream.h>
int main()
{
int x, y;
cout << "Enter two integers: ";
cin >> x >> y;
cout << x << ( x == y ? " is" : " is not" )
<< " equal to " << y << endl;
return 0;
}